package com.wkbb.sports.thread;

import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSONObject;
import com.wkbb.common.dto.ResultDTO;
import com.wkbb.common.dto.basic.UserDto;
import com.wkbb.sports.service.PhysicalService;

/**
 * @author 
 * @version V1.0
 * @className ImportStudentTask
 * @description 批量导入学生,家长线程
 * @date 2019/9/19 15:11
 */
public class ImportPhysicalTask implements Callable<ResultDTO<Map<String,Object>>> {

    private static final Logger logger = LoggerFactory.getLogger(ImportPhysicalTask.class);

    private List<Object[]> data;

    private UserDto userDto;

    private Long orgId;

    private Map<String,Object> map;
    
    private Integer currentRow;

    private PhysicalService physicalService;

    public ImportPhysicalTask(PhysicalService physicalService, Map<String,Object> map, UserDto userDto, Long orgId, List<Object[]> data, Integer currentRow) {
        this.data = data;
        this.orgId = orgId;
        this.userDto = userDto;
        this.currentRow = currentRow;
        this.physicalService = physicalService;
        this.map = map;
    }

    @Override
    public ResultDTO<Map<String,Object>> call() throws Exception {
        logger.info("---当前线程----:{}---开启启动---orgId:{},flag:{},currentRow:{},isClearAddressBook:{}",Thread.currentThread().getName(), orgId,currentRow);
        ResultDTO<Map<String,Object>> arrayResultDto = physicalService.saveData(userDto,orgId,data,map,currentRow);
        logger.info("---当前线程----:{}---处理结果---:{}",Thread.currentThread().getName(), JSONObject.toJSONString(arrayResultDto));
        return arrayResultDto;
    }
}
